<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 下
  Date: 2017/6/15
  Time: 20:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h2>商品信息管理系统</h2>
<a href="add">添加商品</a>
<div>
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th>id</th>
            <th>name</th>
            <th>city</th>
            <th>number</th>
            <th>price</th>
            <th>picture</th>
            <th>查看</th>
            <th>编辑</th>
            <th>删除</th>
        </tr>
        <c:forEach items="${items}" var="um">
            <tr>
                <td>${um.id}</td>
                <td>${um.name}</td>
                <td>${um.city}</td>
                <td>${um.number}</td>
                <td>${um.price}</td>
                <td>${um.picture}</td>
                <td><a href="${um.id}">查看</a></td>
                <td><a href="${um.id}/update">编辑</a></td>
                <td><a href="${um.id}/delete">删除</a></td>
            </tr>
        </c:forEach>
    </table>
</div>


<div align="center">
    <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
    ${page.pageNow} 页</font> <a href="myProductPage?pageNow=1">首页</a>
    <c:choose>
        <c:when test="${page.pageNow - 1 > 0}">
            <a href="myProductPage?pageNow=${page.pageNow - 1}">上一页</a>
        </c:when>
        <c:when test="${page.pageNow - 1 <= 0}">
            <a href="myProductPage?pageNow=1">上一页</a>
        </c:when>
    </c:choose>
    <c:choose>
        <c:when test="${page.totalPageCount==0}">
            <a href="myProductPage?pageNow=${page.pageNow}">下一页</a>
        </c:when>
        <c:when test="${page.pageNow + 1 < page.totalPageCount}">
            <a href="myProductPage?pageNow=${page.pageNow + 1}">下一页</a>
        </c:when>
        <c:when test="${page.pageNow + 1 >= page.totalPageCount}">
            <a href="myProductPage?pageNow=${page.totalPageCount}">下一页</a>
        </c:when>
    </c:choose>
    <c:choose>
        <c:when test="${page.totalPageCount==0}">
            <a href="myProductPage?pageNow=${page.pageNow}">尾页</a>
        </c:when>
        <c:otherwise>
            <a href="myProductPage?pageNow=${page.totalPageCount}">尾页</a>
        </c:otherwise>
    </c:choose>
</div>
</body>
</html>
